package io.zhengsh.data.sharding.mapper;

import io.zhengsh.data.sharding.entity.OrderEntity;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface OrderEntityMapper {

    @Insert("insert into order(`id`, `code`) values(#{id}, #{code})")
    Integer insert(OrderEntity orderEntity);

    @Select("select * from order where 1=1" +
            " <if test='id != null'>" +
            " id = #{id}" +
            "</if>")
    List<OrderEntity> query(OrderEntity orderEntity);
}
